import request from '@/utils/request'

export default {
  // 列表
  query(data) {
    return request({
      url: `/v1/contract/contract/list`,
      method: 'post',
      data
    })
  },
  // 作废合同
  cancel(data) {
    return request({
      url: `/v1/contract/contract/batch-disable`,
      method: 'post',
      data
    })
  },
  // 更新合同
  update(data) {
    return request({
      url: `/v1/contract/contract/update`,
      method: 'post',
      data
    })
  },
  // 发送合同
  send(data) {
    return request({
      url: `/v1/contract/contract/send-email`,
      method: 'post',
      data
    })
  },
  // 下载合同
  downloadExcel(data) {
    return request({
      url: `/v1/contract/contract/download-excel`,
      method: 'post',
      timeout: 120000,
      data
    })
  },
  // 下载标签（包括合同）
  downloadLabel(data) {
    return request({
      url: `/v1/contract/contract/batch-download-label`,
      method: 'post',
      data
    })
  },
  // 上传合同
  upload(data) {
    return request({
      url: `/v1/contract/contract/upload`,
      method: 'post',
      data
    })
  },
  // 增加下载次数
  downloadCount(data) {
    return request({
      url: `/v1/contract/contract/add-download-count`,
      method: 'post',
      data
    })
  },
  // 批量修改交期
  updateDelivery(data) {
    return request({
      url: `/v1/contract/contract/batch-update-delivery`,
      method: 'post',
      data
    })
  },
  // 获取邮件正文
  getEmailInfo(params) {
    return request({
      url: `/v1/contract/contract/get-email-info`,
      method: 'get',
      params
    })
  },
  //合同模板
  getTemplateOption(params) {
    return request({
      url: `/v1/purchase-config/contract-template/get-template-id-option`,
      method: 'get',
      params
    })
  },
}
